import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class code1_2 {
    public static int count;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        int r = in.nextInt();
        count = 0;
        StringBuffer sb = new StringBuffer();
        for (int i = l; i <= r; i++) {
            sb.append(i);
        }
        for(char c:sb.toString().toCharArray()) {
            if(c == '2') {
                count++;
            }
        }
        System.out.println(count);
    }
}